﻿using Pay.Data;
using Pay.DTO;
using Pay.TO;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Pay.IService {
    public interface IMerchantService {
        PagedResult<merchant_info> GetMerchant(MerchantQuery query);
        List<merchant_dto> GetOems();
        merchant_info GetMerchant(long id);
        Merchant GetMerchant(string bindNo);
        Data.BankCode GetBankCode(string accountNo, string cardType);
        merchant_dto Get(long id);

        /// <summary>
        /// 验证用户密码
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        bool ValidUserPassword(long userId, string password);

        authinfo_dto GetAuth(long merchantId);
        authinfo_dto GetAuthById(long id);

        merchant_dto Get(string merchant_no);
        /// <summary>
        /// 根据域名获取信息
        /// </summary>
        /// <param name="Domain"></param>
        /// <returns></returns>
        merchant_dto GetMerchantByDomain(string Domain);

        int Delete(long id);

        void CertifyVerify(certify_verify model, string remark);
        /// <summary>
        /// 已确认实名
        /// </summary>
        /// <returns>The verifyed.</returns>
        /// <param name="id">Identifier.</param>
        int CertifyVerifyed(long id);
        PagedResult<authinfo_dto> Get(MemberQuery query);
        /// <summary>
        /// 实名认证后台审核
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="manageId"></param>
        /// <returns></returns>
        bool AuthInfoAudit(authinfo_dto dto, long manageId);
        /// <summary>
        /// 重置认证次数
        /// </summary>
        /// <param name="authId"></param>
        /// <returns></returns>
        bool ResetAuthNum(long authId);
        /// <summary>
        /// 查询用户的所有上级（N），默认包括本身
        /// </summary>
        /// <param name="id"></param>
        /// <param name="contains">是否包括本身</param>
        /// <returns></returns>
        List<merchant_dto> GetParents(long id, bool contains = true);
        /// <summary>
        /// 查询所有下级，默认不包括本身
        /// </summary>
        /// <returns>The childs.</returns>
        /// <param name="id">Identifier.</param>
        List<merchant_dto> GetChilds(long id, bool contains = false);
        /// <summary>
        /// 通过手机和密码登录
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        merchant_dto Login(string mobile, string password, string oem_no);
        /// <summary>
        /// 通过手机登录
        /// </summary>
        /// <param name="Mobile"></param>
        /// <returns></returns>
        merchant_dto LoginByMobile(string mobile, string oem_no);
        /// <summary>
        /// token登录和注册
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        merchant_dto TokenLogin(string mobile, string code, string mobile_code = "86");
        /// <summary>
        /// 创建Token测试（运营）用户
        /// </summary>
        int CreateTokenTestUser(string mobileSuffix);
        /// <summary>
        /// token 实名认证
        /// </summary>
        /// <param name="model"></param>
        /// <param name="merchantId"></param>
        /// <returns></returns>
        Task<bool> VerificationNoCard(token_cardno_model model, long merchantId);
        /// <summary>
        /// token 实名认证--任务
        /// </summary>
        /// <returns></returns>
        Task<authinfo_req> VerificationCard(token_auth_model model, long merchantId);
        /// <summary>
        /// token 邀请码
        /// </summary>
        /// <param name="model"></param>
        /// <param name="merchantId"></param>
        /// <returns></returns>
        bool InvitationCode(token_invitation_code_model model, long merchantId);
        /// <summary>
        /// token 获取用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        token_user_info GetTokenUser(long id);
        /// <summary>
        ///  token 修改昵称
        /// </summary>
        /// <param name="nickName"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        bool SaveUserNickName(string nickName, long id, string oem_no);
        /// <summary>
        /// token 修改用户
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        bool UpdateUser(merchant_dto dto);
        /// <summary>
        /// 通过手机和密码注册
        /// </summary>
        /// <param name="register">注册请求信息</param>
        /// <returns></returns>
        merchant_dto Register(register_model register);
        /// <summary>
        /// 提交认证商户
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="dto">Dto.</param>
        verify_auth_result Auth(verify_auth_model dto);
        /// <summary>
        /// 上传完整的进件信息并创建商户
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="model">Dto.</param>
        List<verify_auth_result> Auth(batch_auth_model model);
        /// <summary>
        /// 审核商户认证
        /// </summary>
        /// <returns>The auth.</returns>
        /// <param name="merchant_id">Merchant identifier.</param>
        /// <param name="auth_info">Auth info.</param>
        /// <param name="auth_status">Auth status.</param>
        /// <param name="msg">Message.</param>
        Task<int> Auth(long merchant_id, auth_info_setting auth_info, AuthStatusEnum auth_status, string msg = "");
        /// <summary>
        /// 扫码认证
        /// </summary>
        /// <returns>The native.</returns>
        /// <param name="merchant_id">Merchant identifier.</param>
        /// <param name="auth_status">Auth status.</param>
        /// <param name="msg">Message.</param>
        Task<int> AuthNative(long merchant_id, AuthStatusEnum auth_status, string msg = "");
        /// <summary>
        /// 保存修改认证信息
        /// </summary>
        /// <returns>The edit.</returns>
        /// <param name="merchant_id">Merchant identifier.</param>
        /// <param name="auth_info">Auth info.</param>
        Task<int> AuthEdit(long merchant_id, auth_info_setting auth_info);
        /// <summary>
        /// 找回密码
        /// </summary>
        /// <param name="forget">找回密码请求信息</param>
        /// <returns></returns>
        bool Forget(forget_model forget);
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="user_id"></param>
        /// <param name="password"></param>
        /// <param name="re_password"></param>
        /// <returns></returns>
        bool ChangePwd(long user_id, string old_password, string password, string re_password);
        /// <summary>
        /// 更新商户信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        int Update(merchant_info dto);
        /// <summary>
        /// 商户向通道进件
        /// </summary>
        /// <returns>The channel register.</returns>
        string MerchantChannelRegister(merchant_register_model dto);
        int MerchantChannelRegister(merchant_register_dto dto);
        merchant_register_dto GetMerchantChannelRegister(long id);
        merchant_register_dto GetMerchantChannelRegister(long merchant_id, PayChannel channel);
        /// <summary>
        /// 删除进件
        /// </summary>
        /// <returns>The merchant register.</returns>
        /// <param name="id">Identifier.</param>
        int DeleteMerchantRegister(long id);

        int SetMerchantRegister(string merchant_no);
        /// <summary>
        /// 用户是否已进件过
        /// </summary>
        /// <returns>The register channel.</returns>
        /// <param name="mobile">Mobile.</param>
        string IsRegisterChannel(string mobile);

        /// <summary>
        /// token 注册
        /// </summary>
        /// <param name="register_model"></param>
        /// <returns></returns>
        Task<merchant_dto> TokenRegisterAsync(token_register_model register_model);
        /// <summary>
        /// token 注册
        /// </summary>
        /// <param name="register_model"></param>
        /// <returns></returns>
        merchant_dto TokenRegister2Async(token_register_model register_model);
        /// <summary>
        /// token短信登录
        /// </summary>
        /// <param name="login_model"></param>
        /// <returns></returns>
        merchant_dto TokenLoginByCode(token_login_model login_model);

        /// <summary>
        /// 实名认证
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<bool> VNoCard(fengxinzi_cardno_model model);

        /// <summary>
        /// 查询用户进件数据
        /// </summary>
        /// <returns>The register code.</returns>
        /// <param name="id_card">Identifier card.</param>
        /// <param name="channel">Channel.</param>
        MerchantRegister GetRegisterCode(string id_card, PayChannel channel);

        /// <summary>
        /// 所有已进件通道
        /// </summary>
        /// <param name="merchant_id"></param>
        /// <returns></returns>
        List<merchant_register_dto> GetRegisters(long merchant_id);

        /// <summary>
        /// 所有已开通支付方式
        /// </summary>
        /// <param name="merchant_id"></param>
        /// <returns></returns>
        List<merchant_payment_dto> GetPayments(long merchant_id);

        /// <summary>
        /// 查询用户的下一级，不包括本身
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        IEnumerable<merchant_info> GetOneChild(long id);

        /// <summary>
        /// 获取等级id
        /// </summary>
        /// <returns>The grade identifier.</returns>
        /// <param name="grade_no">Grade no.</param>
        /// <param name="merchant_no">Merchant no.</param>
        long GetGradeId(string grade_no, string merchant_no);

        /// <summary>
        /// 修改token 用户推荐人
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        int UpdateParent(long userId, string parentMobile, long sysUserId, string oem_no);

        merchant_register_dto GetRegister(string id_card, PayChannel channel);
        /// <summary>
        /// 后台注册
        /// </summary>
        /// <param name="register_model"></param>
        /// <returns></returns>
        bool TokenWebRegister(token_web_register_model register_model);
        /// <summary>
        /// 后台修改token用户密码
        /// </summary>
        /// <param name="modify_model"></param>
        /// <returns></returns>
        bool TokenModifyPwd(token_modify_pwd_model modify_model);
      PagedResult<merchant_dto> GetOneChild(MerchantChildQuery query);
        /// <summary>
        /// 发起实名认证
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<VerifyResult> GetVerifyToken(long userId);
        /// <summary>
        /// 实名认证状态 认证资料
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<VerifyStatusResult> GetVerifyStatus(long userId);
    }
}
